package com.itnoob.service.impl.decorator;

import com.itnoob.service.UserService;

/**
 * @author zhoujun
 * @date 2024/12/7 10:17
 * 定义一个抽象的装饰者类,它实现了service接口,并持有一个service的引用
 */
public abstract  class UserServiceDecorator implements UserService {

    protected UserService userService;


    public UserServiceDecorator(UserService userService) {
        this.userService = userService;
    }

    //装饰者默认实现了service接口的方法,但是可以在子类中进行覆盖或者扩展
    @Override
    public String getUserName(int id) {

        return userService.getUserName(id);
    }
}
